@include('Admin.public.head')
<body>
@include('Admin.public.menu')
<div class=" admin-content" id="system">
    <div class="daohang">

    </div>
    <div class="admin-biaogelist">
        <div class="listbiaoti am-cf">
            <ul class="am-icon-flag on"> 系统公告</ul>
{{--            <dl class="am-icon-home" style="float: right;"> 当前位置： 首页 > <a href="#">商品列表</a></dl>--}}
            <dl>
                <button type="button" class="am-btn am-round am-btn-xs am-icon-plus"><a  href="/admin/system/addNotice">添加公告</a> </button>
            </dl>
        </div>
        <form class="am-form am-g" @click="systemInitialize()">

            <table width="100%" class="am-table am-table-bordered am-table-radius am-table-striped">
                <thead>
                <tr class="am-success">
                    {{--<th class="table-check"><input type="checkbox" /></th>--}}
                    <th >公告标题</th>
                    <th >开始时间</th>
                    <th >结束时间</th>
                    <th >内容</th>
                    <th >状态</th>
                    <th >操作</th>
                </tr>
                </thead>
                <tbody>
                <tr v-for="val in notice">
                    {{--<td><input type="checkbox" /></td>--}}
                    <td>@{{ val.notice_name }}</td>
                    <td>@{{ val.release_time }}</td>
                    <td>@{{ val.deadline }}</td>
                    <td v-html="val.content"></td>
                    <td>@{{ val.is_publish==1?'上线':'已取消' }}</td>
                    <td>
                        <div class="am-btn-toolbar">
                            <div class="am-btn-group am-btn-group-xs">
                                {{--<button class="am-btn am-btn-default am-btn-xs am-text-success am-round"><span class="am-icon-search"></span> </button>--}}
                                <button type="button" class="am-btn am-btn-default am-btn-xs am-text-secondary am-round" v-on:click="edit(val.id)"><span class="am-icon-pencil-square-o"></span></button>
                                {{--<button class="am-btn am-btn-default am-btn-xs am-text-warning  am-round"><span class="am-icon-copy"></span></button>--}}
                                <button type="button" class="am-btn am-btn-default am-btn-xs am-text-danger am-round" v-on:click="delet(val.id)"><span class="am-icon-trash-o"></span></button>
                            </div>
                        </div>
                    </td>
                </tr>
                </tbody>
            </table>
{{--            <ul class="am-pagination am-fr">--}}
{{--                <li class="am-disabled"><a href="#">«</a></li>--}}
{{--                <li class="am-active"><a href="#">1</a></li>--}}
{{--                <li><a href="#">2</a></li>--}}
{{--                <li><a href="#">3</a></li>--}}
{{--                <li><a href="#">4</a></li>--}}
{{--                <li><a href="#">5</a></li>--}}
{{--                <li><a href="#">»</a></li>--}}
{{--            </ul>--}}
            <hr />
        </form>
        <script>
            var system = new Vue({
                el:"#system",
                data: {
                    users:[],// 系统管理员列表
                    notice:[]
                },
                //事件
                methods: {
                    //初始化 系统管理员列表
                    itialize:function () {
                        var _this = this
                        $.post("/admin/system/setNotice",{'_token':'{{csrf_token()}}',class:'select'},function (res) {
                            if(res.code){
                                _this.notice = res.data
                                console.log(_this.notice)
                                // system.users = res.data
                            } else {
                                layer.msg(res.data);
                            }
                        });
                    },
                    //编辑 分公司列表
                    edit:function (id) {
                        window.location.href="/admin/system/addNotice?id="+id+"&type=edit";
                    },
                    //删除 分公司列表
                    delet:function (id) {
                        $.post("/admin/system/setNotice",{'_token':'{{csrf_token()}}',class:'delete',id:id},function (res) {
                            if(res.code){
                                layer.msg(res.data);
                                location.href="/admin/system/notice"
                            } else {
                                layer.msg(res.data);
                            }
                        });
                    }
                },
                //自动执行
                mounted: function () {
                    this.itialize();//分公司
                },
            })
        </script>
@include('Admin.public.foot')